const state = {
    hiddenDangerList: getHiddenDanger(),
    highRiskAreaList: getHighRiskArea(),
    riskCompanyList: getRiskCompany()
}

const getters = {
    hiddenDangerList: state => state.hiddenDangerList,
    highRiskAreaList: state => state.highRiskAreaList,
    riskCompanyList: state => state.riskCompanyList
}

const mutations = {

}

const actions = {

}

export default {
    state,
    getters,
    actions,
    mutations
}

function getHiddenDanger() {
    const temp = '电气火灾,安全通道堵塞,危化品存储不当'.split(',');
    return getArray(temp);
}

function getHighRiskArea() {
    const temp = '横塘村农贸市场周边,潘桥物流市场周边,陈岱村出租房'.split(',');
    return getArray(temp);
}

function getRiskCompany() {
    const temp = '风险社会单位,阿影饭庄旅馆,好邻居超市'.split(',');
    return getArray(temp);
}

function getArray(temp) {
    let arr = temp.map(t => {
        const obj = {
            key: t,
            name: t
        }
        return obj;
    });
    return arr;
}
